package com.tfy.liquor.test;


import java.awt.*;
import javax.swing.*;
import static javax.swing.JFrame.*;
import java.awt.event.*;
import javax.swing.*;

public class Window<wi> extends JFrame {
    JMenuBar menubar;
    JMenu menu, menu2, menu3, menuhelp;
    JMenuItem item1, item2;
    JLabel text;
    String s="学籍管理系统";
    int x=300;
    int y=200;
    int w=500;
    int h=500;
    public Window() {
        init(s);
        setLocation(x, y);
        setSize(w, h);
        setVisible(true);
        setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    }
    void init(String s){
        setTitle(s);
        setLayout(null);
        text = new JLabel("欢迎使用学籍管理系统 !");
        text.setForeground(Color.red);
        text.setFont(new java.awt.Font("Dialog", 1, 22));
        add(text);
        text.setBounds(140, 150, 250, 150);
        menubar = new JMenuBar();
        menu = new JMenu("在线登陆");
        menu2 = new JMenu("用户管理");
        menu3 = new JMenu("数据维护");
        menuhelp = new JMenu("帮助");
        item1 = new JMenuItem("用户登录", new ImageIcon("Login,gif"));
        item2 = new JMenuItem("退 出", new ImageIcon("Exit.gif"));
        menu.add(item1);
        menu.add(item2);
        menubar.add(menu);
        menubar.add(menu2);
        menubar.add(menu3);
        menubar.add(menuhelp);
        setJMenuBar(menubar);
        item1.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                // TODO Auto-generated method stub
                if (e.getSource() == item1) {
                    new MyJDialog(Window.this).setVisible(true);
                }
            }
        });
    }
    class MyJDialog extends JDialog {
        public MyJDialog(Window wi) {
            super(wi, "用户登录", true);
            Panel myPanel = new Panel();
            myPanel.add(new JLabel("<html><body>"
                    + "<br><br><br><span>请输入用户名： </span>"
                    + " <input type='text' style='width: 100' > <br><br>"
                    + " <span>&emsp;请输入密码： </span>"
                    + "   <input type='password' style='width: 20' >"
                    + "</body></html>"));
            /*
             * myPanel.add(new JLabel("请输入用户名：")); myPanel.add(new JTextField(10));
             * myPanel.add(new JLabel("请输入密码：")); myPanel.add(new JTextField(10));
             */
            this.setBounds(350, 300, 500, 200);
            this.add(myPanel);
        }
    }
    public static void main(String[] args) {
        Window win=new Window();
    }

}
